import csv

def csv2array(inCsv):
	result=[]
	reader=csv.reader(open(inCsv, "rb"))
	for i in reader:
		result.append(i)
	head=result[0]
	return head,result

def array2csv(inArray,inhead,path):
	writer=csv.writer(open(path, "wb"))
	for i in inArray:
		writer.writerow(i)

def populationToCsv(inpop,path):
    writer=csv.writer(open(path, "wb"))
    writer.writerow(inpop.head)
    for i in inpop.pool:
        ind=i.data
        writer.writerow(i.data)